package com.apes.fn.ssm.repository;

import com.apes.fn.ssm.model.StockConfig;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface StockConfigRepository extends CustomRepository<StockConfig, String> {

    @Query(value = "SELECT A.ID FROM MAS_STOCK A", nativeQuery = true)
    List findAllId();

    @Query(value = "SELECT A.FITTING_MESSAGE_ID FROM MAS_STOCK A WHERE A.LOCATION_ID = :locationId", nativeQuery = true)
    List<String> findAllFittingMessage(@Param("locationId") String locationId);

    @Query(value = "SELECT A.* FROM MAS_STOCK A WHERE A.LOCATION_ID = :locationId AND A.FITTING_MESSAGE_ID = :fittingName", nativeQuery = true)
    StockConfig findOne(@Param("locationId") String locationId,@Param("fittingName") String fittingName);
}
